#pragma once
#include "../Utilities/utilities.h"
#include "Vertex.h"
#include "Shaders.h"
#include "Texture.h"
#include "ResourceManager.h"

class SimpleMesh
{
public:
	GLuint vbo;
	GLuint ido;
	Vertex* vertexData;
	int numVertex;
	GLushort* indicesData;
	int numIndex;

	//\ Map vi tri texture trong danh sach texture load tu resource cho mesh
	int textureMapId;
	SimpleMesh();
	~SimpleMesh();

	/*void Render(Shaders *sha)
	{
		glBindBuffer(GL_ARRAY_BUFFER, vbo);
		int size;
		glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &size);
		size /= sizeof(Vertex);
		if (sha->a_positon != -1)
		{
			glEnableVertexAttribArray(sha->a_positon);
			glVertexAttribPointer(sha->a_positon, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);
		}

		if (sha->a_uv != -1)
		{
			glEnableVertexAttribArray(sha->a_uv);
			glVertexAttribPointer(sha->a_uv, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)12);
		}

		if (sha->a_normal != -1)
		{
			glEnableVertexAttribArray(sha->a_normal);
			glVertexAttribPointer(sha->a_normal, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)20);
		}

		if (sha->a_tangent != -1)
		{
			glEnableVertexAttribArray(sha->a_tangent);
			glVertexAttribPointer(sha->a_tangent, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)32);
		}

		if (sha->a_binormal != -1)
		{
			glEnableVertexAttribArray(sha->a_binormal);
			glVertexAttribPointer(sha->a_binormal, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)44);
		}

		ResourceManager::GetInstance()->listTexture[textureMapId]->Bind(GL_TEXTURE0);
		if (indicesData)
		{
			glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ido);
			glDrawElements(GL_TRIANGLES, numIndex, GL_UNSIGNED_SHORT, 0);
		}
		else
		{
			glDrawArrays(GL_TRIANGLES, numVertex,0);
		}
		ResourceManager::GetInstance()->listTexture[textureMapId]->UnBind(GL_TEXTURE0);
	}*/
};

